package com.wt.springsamples.ext;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.stereotype.Component;

//@Component
public class MyBeanDefinitionRegistryPostProcessor implements BeanDefinitionRegistryPostProcessor {
    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {

        System.out.println("BeanDefinitionRegistryPostProcessor...postProcessBeanDefinitionRegistry 方法。。。。");
    }

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
//        String [] beanNames = beanFactory.getBeanNamesForType(RedisTemplate.class);
//        for(String beanName : beanNames){
//            if(beanFactory.getBean(beanName)!=null){
//                BeanDefinition bd = beanFactory.getBeanDefinition(beanName);
//                if(bd!=null){
//                    System.out.println("redisTemplate");
//                }
//            }
//        }

        System.out.println("BeanDefinitionRegistryPostProcessor...postProcessBeanFactory 方法。。。。");
    }
}
